<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加编辑页</title>
</head>
<body>
    <table>
        <tr>
            <h1>添加博客或者修改</h1>
        </tr>
        <tr>
            <th hidden="hidden">
                id:<input type="text" name="id">
            </th>
        </tr>
        <tr>
            <th>
                标题:<input type="text" name="title">
            </th>
        </tr>
        <tr>
            <th>
                摘要:<input type="text" name="abstract">
            </th>
        </tr>
        <tr>
            <th>
                内容:<input type="text" name="content">
            </th>
        </tr>
        <tr>
            <th>
                分类:<input type="text" name="classify">
            </th>
        </tr>
        <tr>
            <th>
                作者:<input type="text" name="author">
            </th>
        </tr>
        <tr>
            <th>
                <input style="margin-left: 100px; margin-top: 5px;" type="button" value="保存" style="margin: 10px;" onclick="save()">
                <input style="margin-left: 10px;" type="button" value="取消" style="margin: 10px;" onclick="cancal()">
            </th>
        </tr>
    </table>
    <script src="./js/jquery-3.6.0.min.js"></script>
    <script>
        let id=location.search.split('?')[1];
        if(id){
            $.get(`http://localhost:8000/produce/${id}`,data=>{
                $('[name=id]').val(data[0]['id']);
                $('[name=title]').val(data[0]['title'])
                $('[name=abstract]').val(data[0]['abstract']);
                $('[name=content]').val(data[0],['content']);
                $('[name=classify]').val(data[0]['classify']);
                $('[name=author]').val(data[0]['author'])
            })
        }
    </script>
    <script src="./init.js"></script>
    <script src="./product_api.js"></script>
</body>
</html>